<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="com.dao.CommonDAO"%>
<%@page import="com.util.PageManager"%>
<%@page import="com.util.Info"%>
<%@page import="com.model.Member"%>

<%@page import="com.model.Jieyuerecord"%>
<%@page import="com.model.Goods"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="en">
  <head>
	<meta charset="utf-8">
    <title>后台管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <base href="<%=basePath%>">
    <meta name="description" content="member panel developed with the Bootstrap from Twitter.">
    <meta name="author" content="travis">
    
	<link rel="stylesheet" type="text/css" href="/bookborrowssh/member/lib/bootstrap/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="/bookborrowssh/member/stylesheets/theme.css">
    <link rel="stylesheet" href="/bookborrowssh/member/lib/font-awesome/css/font-awesome.css">

    <script src="/bookborrowssh/member/lib/jquery-1.7.2.min.js" type="text/javascript"></script>

    <!-- Demo page code -->

    <style type="text/css">
        #line-chart {
            height:300px;
            width:800px;
            margin: 0px auto;
            margin-top: 1em;
        }
        .brand { font-family: georgia, serif; }
        .brand .first {
            color: #ccc;
            font-style: italic;
        }
        .brand .second {
            color: #fff;
            font-weight: bold;
        }
    </style>

    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="../assets/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="../assets/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="../assets/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="../assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="../assets/ico/apple-touch-icon-57-precomposed.png">

	<script type="text/javascript" src="/bookborrowssh/layer/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="/bookborrowssh/layer/layer.js"></script>
  </head>
  
  <body class="">
    
    <%	
     CommonDAO dao = (CommonDAO)Info.getDao(request,"CommonDAO");
     Member member = (Member)session.getAttribute("member");
	 String hql = "from Jieyuerecord where 1=1 and delstatus='0' and memberid='"+member.getId()+"'";
	 String url = "/bookborrowssh/member/jieyuerecord.jsp?1=1";
	 String key = request.getParameter("key")==null?"":request.getParameter("key");
	 String key1 = request.getParameter("key1")==null?"":request.getParameter("key1");
	 String f = request.getParameter("f");
	 if(f==f)
	 {
	 key = Info.getUTFStr(key);
	 key1 = Info.getUTFStr(key1);
	 }
	 if(!key.equals(""))
	 {
	 hql+=" and gid in (select id from Goods where goodname like '%"+key+"%')";
	 url+="&key="+key;
	 }
	 if(!key1.equals(""))
	 {
	 hql+=" and isyq like '%"+key1+"%'";
	 url+="&key1="+key1;
	 }
	 hql+=" order by id desc";
	%>

	<jsp:include page="/member/top.jsp"></jsp:include>
    
    <jsp:include page="/member/left.jsp"></jsp:include>
    

    
       <div class="content">
        
          <div class="header">
            
            <h1 class="page-title">借阅信息</h1>
        </div>
        
                <ul class="breadcrumb">
            <li><a href="member/index.jsp">Home</a> <span class="divider">/</span></li>
            <li class="active">借阅信息</li>
        </ul>

        <div class="container-fluid">
            <div class="row-fluid">
            
            	<div class="btn-toolbar">
					<div class="search-well">
						<form action="member/jieyuerecord.jsp?f=f" method="post" class="form-inline">
							<input class="input-xlarge" placeholder="书名..." id="key" name="key" type="text" value="<%=key %>">
							<select id="key1" name="key1" class="input-xlarge">
							<option value="">请选择</option>
							<option value="正常" <%=key1.equals("正常")?"selected":"" %>>正常</option>
							<option value="已逾期" <%=key1.equals("已逾期")?"selected":"" %>>已逾期</option>
							</select>
		                    <button class="btn" type="submit"><i class="icon-search"></i> Go</button>
						</form>	
					</div>  	
				</div>
<div class="well">

    <table class="table">
      <thead>
        <tr>
          <th>书名</th>
          <th>借书时间</th>
          <th>归还时间</th>
          <th>借阅状态</th>
          <th>说明</th>
          <th style="width: 50px;"></th>
        </tr>
      </thead>
      <tbody>
      <%
	    PageManager pageManager = PageManager.getPage("/bookborrowssh/member/jieyuerecord.jsp?1=1",10, request);
	    pageManager.doList(hql);
	    PageManager bean= (PageManager)request.getAttribute("page");
	    ArrayList<Jieyuerecord> list=( ArrayList<Jieyuerecord>)bean.getCollection(); 
	   for(Jieyuerecord j:list){
	   Goods g = (Goods)dao.findById(j.getGid(),"Goods");
	    %>
        <tr>
          <td><a href="member/goodsdetails.jsp?id=<%=g.getId() %>"><%=g.getGoodname() %></a></td>
          <td><%=j.getStime().substring(0,10) %></td>
          <td><%=j.getEtime() %></td>
          <td><%=j.getIszj() %></td>
          <td>
          <%if(Info.compare_datezq(Info.getDateStr().substring(0,10),j.getEtime()).equals("small")&&Info.dayToday(Info.getDateStr(),j.getEtime()+" 00:00:00")<3&&j.getIszj().equals("在借")){ %>
          <span style="color:red">距还书时间不足2天</span>
          <%} %>
          <%if(j.getIszj().equals("已归还")){ %>
          <%=j.getIsyq().equals("正常")?"正常":"<font style='color:red'>"+j.getIsyq()+"&nbsp;&nbsp;" %>
          <%if(j.getIsyq().equals("已逾期")){ %>
          <%=j.getFakuan()==0?"":"<font style='color:red'>"+j.getYqday()+"天&nbsp;&nbsp;&nbsp;&nbsp;罚款:"+j.getFakuan()+"元</font>" %>
          <%} %>
          <%} %>
          </td>
          <td>
          <%if(j.getIszj().equals("在借")){ %>
              <a href="huanShu.action?id=<%=j.getId() %>" ><i class="">还书</i></a>
           <%} %>
           <%if(j.getIszj().equals("已归还")){ %>
              <a href="jieyuerecordDel.action?id=<%=j.getId() %>" ><i class="icon-remove"></i></a>
           <%} %>
          </td>
        </tr>
        <%} %>
      </tbody>
    </table>
</div>
<div class="pagination">
    ${page.info }
</div>
</div>
</div>
</div>
    <script type="text/javascript">
    function membermemberAdd(){
		location.href="member/memberadd.jsp";
    }
        $("[rel=tooltip]").tooltip();
        $(function() {
            $('.demo-cancel-click').click(function(){return false;});
        });
        <%
String suc = (String)request.getAttribute("suc");
if(suc!=null){
%>
layer.msg('<%=suc%>');
<%}%>
        <%
String no = (String)request.getAttribute("no");
if(no!=null){
%>
layer.msg('<%=no%>');
<%}%>
    </script>
  </body>
</html>
